<template>
  <div>

        <child ref="hw" @add="cartAdd($event)"> </child>

  </div>
</template>

<script>

import Child from './child.vue'

export default {
  provide:{dong:'小钟牛逼'},
  components:{
        Child,
  },
  created(){
      // 父组件先于子组件通信
      console.log(this.$refs.hw)
  },
  mounted(){
      this.$refs.hw.foo="ccccccccccccccccccc"
      this.$children[0].foo="哈哈哈哈哈哈哈"
  },
  methods:{
      cartAdd(e){
          console.log(e)
      }
  }

};
</script>

<style scoped>

</style>
